<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name',22)->comment('昵称')->index();
            $table->string('username',22)->comment('用户姓名')->unique();
            $table->string('id_card',18)->nullable()->comment('身份证')->unique();
            $table->string('email')->comment('邮箱')->unique();
            $table->string('phone',11)->nullable()->comment('手机')->index();
            $table->string('password')->comment('密码');
            $table->boolean('super_admin')->default(0)->comment('是否是超级管理员');
            $table->boolean('status')->default(1)->comment('是否启用用户，状态 0：禁用 1：启用 ');
            $table->string('avatar')->comment('用户头像')->nullable();
            $table->unsignedBigInteger('integral')->default(0)->comment('用户积分');
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
